package com.upb.webserver.dao.mapper;

import com.upb.webserver.dao.entity.TbCompany;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import com.upb.webserver.dao.entity.TbCompanyExample;
import java.util.List;
import java.util.Optional;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;

public interface TbCompanyMapper {

    @Select({ "select", "company_name", "from tb_company", "where id = #{companyId,jdbcType=INTEGER}" })
    @Results({ @Result(column = "company_name", property = "name", jdbcType = JdbcType.VARCHAR) })
    String selectNameByPrimaryKey(@Param("companyId") Integer companyId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_company
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbCompanySqlProvider.class, method = "countByExample")
    long countByExample(TbCompanyExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_company
     *
     * @mbg.generated
     */
    @DeleteProvider(type = TbCompanySqlProvider.class, method = "deleteByExample")
    int deleteByExample(TbCompanyExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_company
     *
     * @mbg.generated
     */
    @Delete({ "delete from tb_company", "where id = #{id,jdbcType=INTEGER}" })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_company
     *
     * @mbg.generated
     */
    @Insert({ "insert into tb_company (company_name, status, ", "developer_id, gmt_create, ", "gmt_modified, description)", "values (#{companyName,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT}, ", "#{developerId,jdbcType=INTEGER}, #{gmtCreate,jdbcType=TIMESTAMP}, ", "#{gmtModified,jdbcType=TIMESTAMP}, #{description,jdbcType=LONGVARCHAR})" })
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false, resultType = Integer.class)
    int insert(TbCompany record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_company
     *
     * @mbg.generated
     */
    @InsertProvider(type = TbCompanySqlProvider.class, method = "insertSelective")
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false, resultType = Integer.class)
    int insertSelective(TbCompany record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_company
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbCompanySqlProvider.class, method = "selectByExampleWithBLOBs")
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "company_name", property = "companyName", jdbcType = JdbcType.VARCHAR), @Result(column = "status", property = "status", jdbcType = JdbcType.TINYINT), @Result(column = "developer_id", property = "developerId", jdbcType = JdbcType.INTEGER), @Result(column = "gmt_create", property = "gmtCreate", jdbcType = JdbcType.TIMESTAMP), @Result(column = "gmt_modified", property = "gmtModified", jdbcType = JdbcType.TIMESTAMP), @Result(column = "description", property = "description", jdbcType = JdbcType.LONGVARCHAR) })
    List<TbCompany> selectByExampleWithBLOBs(TbCompanyExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_company
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbCompanySqlProvider.class, method = "selectByExample")
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "company_name", property = "companyName", jdbcType = JdbcType.VARCHAR), @Result(column = "status", property = "status", jdbcType = JdbcType.TINYINT), @Result(column = "developer_id", property = "developerId", jdbcType = JdbcType.INTEGER), @Result(column = "gmt_create", property = "gmtCreate", jdbcType = JdbcType.TIMESTAMP), @Result(column = "gmt_modified", property = "gmtModified", jdbcType = JdbcType.TIMESTAMP) })
    List<TbCompany> selectByExample(TbCompanyExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_company
     *
     * @mbg.generated
     */
    @Select({ "select", "id, company_name, status, developer_id, gmt_create, gmt_modified, description", "from tb_company", "where id = #{id,jdbcType=INTEGER}" })
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "company_name", property = "companyName", jdbcType = JdbcType.VARCHAR), @Result(column = "status", property = "status", jdbcType = JdbcType.TINYINT), @Result(column = "developer_id", property = "developerId", jdbcType = JdbcType.INTEGER), @Result(column = "gmt_create", property = "gmtCreate", jdbcType = JdbcType.TIMESTAMP), @Result(column = "gmt_modified", property = "gmtModified", jdbcType = JdbcType.TIMESTAMP), @Result(column = "description", property = "description", jdbcType = JdbcType.LONGVARCHAR) })
    TbCompany selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_company
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbCompanySqlProvider.class, method = "updateByExampleSelective")
    int updateByExampleSelective(@Param("record") TbCompany record, @Param("example") TbCompanyExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_company
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbCompanySqlProvider.class, method = "updateByExampleWithBLOBs")
    int updateByExampleWithBLOBs(@Param("record") TbCompany record, @Param("example") TbCompanyExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_company
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbCompanySqlProvider.class, method = "updateByExample")
    int updateByExample(@Param("record") TbCompany record, @Param("example") TbCompanyExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_company
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbCompanySqlProvider.class, method = "updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(TbCompany record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_company
     *
     * @mbg.generated
     */
    @Update({ "update tb_company", "set company_name = #{companyName,jdbcType=VARCHAR},", "status = #{status,jdbcType=TINYINT},", "developer_id = #{developerId,jdbcType=INTEGER},", "gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},", "gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},", "description = #{description,jdbcType=LONGVARCHAR}", "where id = #{id,jdbcType=INTEGER}" })
    int updateByPrimaryKeyWithBLOBs(TbCompany record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_company
     *
     * @mbg.generated
     */
    @Update({ "update tb_company", "set company_name = #{companyName,jdbcType=VARCHAR},", "status = #{status,jdbcType=TINYINT},", "developer_id = #{developerId,jdbcType=INTEGER},", "gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},", "gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}", "where id = #{id,jdbcType=INTEGER}" })
    int updateByPrimaryKey(TbCompany record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_company
     *
     * @mbg.generated
     */
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    @Insert({ "<script>", "insert into tb_company (company_name, ", "status, developer_id, ", "gmt_create, gmt_modified, ", "description)", "values<foreach collection=\"list\" item=\"detail\" index=\"index\" separator=\",\">(#{detail.companyName,jdbcType=VARCHAR}, ", "#{detail.status,jdbcType=TINYINT}, #{detail.developerId,jdbcType=INTEGER}, ", "#{detail.gmtCreate,jdbcType=TIMESTAMP}, #{detail.gmtModified,jdbcType=TIMESTAMP}, ", "#{detail.description,jdbcType=LONGVARCHAR})</foreach></script>" })
    int batchInsert(List<TbCompany> list);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_company
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbCompanySqlProvider.class, method = "getOneByExample")
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "company_name", property = "companyName", jdbcType = JdbcType.VARCHAR), @Result(column = "status", property = "status", jdbcType = JdbcType.TINYINT), @Result(column = "developer_id", property = "developerId", jdbcType = JdbcType.INTEGER), @Result(column = "gmt_create", property = "gmtCreate", jdbcType = JdbcType.TIMESTAMP), @Result(column = "gmt_modified", property = "gmtModified", jdbcType = JdbcType.TIMESTAMP), @Result(column = "description", property = "description", jdbcType = JdbcType.LONGVARCHAR) })
    Optional<TbCompany> getOneByExample(TbCompanyExample example);
}
